class Request {
  constructor(BaseURL) {
    this.BaseURL = BaseURL
  }
  request(options) {
    const {url} = options
    return new Promise((resove, reject) => {
      wx.request({
        ...options,
        url: this.BaseURL + url,
        success: (res) => resove(res.data),
        fail: (err) => reject(err)
      })
    })
  }
  get(options) {
    return this.request({method: "GET", ...options})
  }
  post(options) {
    return this.request({method: "POST", ...options})
  }
}

export const myRequest = new Request('http://codercba.com:9002')